<template>
  <div class="wfull">
    <a-form :labelCol="{ span: 6 }" :wrapperCol="{ span: 18 }">
      <a-form-item label="触点名称" :required="true">
        <ZgInput v-model="obj.name"></ZgInput>
      </a-form-item>
      <a-form-item label="业务描述" :required="false">
        <ZgTextarea v-model="obj.describ"></ZgTextarea>
      </a-form-item>
      <a-form-item label="流程事件类型" :required="true">
        <ZgDictionary v-model="obj.eventType" code="eventType"></ZgDictionary>
      </a-form-item>
      <a-form-item label="调用方式" :required="true">
        <ZgDictionary v-model="obj.callMode" code="callMode"></ZgDictionary>
      </a-form-item>
      <a-form-item label="调用地址" :required="true">
        <ZgInput v-model="obj.callUri"></ZgInput>
      </a-form-item>
      <a-form-item label="是否异步" :required="true">
        <ZgSwitch v-model="obj.isAsync"></ZgSwitch>
      </a-form-item>
      <a-form-item label="业务逻辑类型" :required="true">
        <ZgDictionary v-model="obj.busiType" code="busiType"></ZgDictionary>
      </a-form-item>
      <a-form-item label="是否启用" :required="true">
        <ZgCheckbox v-model="obj.isOpen"></ZgCheckbox>
      </a-form-item>
    </a-form>
  </div>
</template>
<script>
import { dic } from './dic'
export default {
  data () {
    return {
      dic,
      obj: {
        eventType: '',
        callMode: '',
        callUri: '',
        isAsync: false,
        busiType: '',
        isOpen: false,
        describ: '',
        name: '',
        id: '0'
      }
    }
  },
  methods: {
    save () {
      if (this.obj.eventType.length === 0) {
        return this.$result.error('请输入流程事件类型：SUBMIT、RETURN、REVOKE、CANCEL')
      }
      if (this.obj.callMode.length === 0) {
        return this.$result.error('请输入调用方式：API、REFLECT')
      }
      if (this.obj.callUri.length === 0) {
        return this.$result.error('请输入调用地址')
      }
      if (this.obj.busiType.length === 0) {
        return this.$result.error('请输入业务逻辑类型')
      }
      if (this.obj.name.length === 0) {
        return this.$result.error('请输入名称')
      }
      return this.$result.ok(Object.assign({}, this.obj))
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
